package com.taxinfo.utils;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;

public class DateUtil {

    private static Logger logger = LoggerFactory.getLogger(DateUtil.class);
    public static String DATA_FORMAT_FULL = "yyyy-MM-dd HH:mm:ss";

    public static Date endTime(Date date, int nextMonth) {
        Calendar cal = Calendar.getInstance();
        cal.setTime(date);
        cal.add(Calendar.MONTH, nextMonth);
        Date returnValue = cal.getTime();
        logger.info(formatDate(returnValue, DATA_FORMAT_FULL));
        return returnValue;
    }

    public static String formatDate(Date date, String format) {
        SimpleDateFormat time = new SimpleDateFormat(format);
        return time.format(date);
    }


    public static String getCurrentDataForPJ() {
//        return formatDate(new Date(), DATA_FORMAT_FULL);
        return new Date().getTime() + "";
    }
}
